//
//  ViewSelect.m
//  Quiz
//
//  Created by AnhLH-Oriolus on 28/07/2011.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "ViewSelect.h"


@implementation ViewSelect

@synthesize isCheckOption;

- (id)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code.
		UIImageView *vbkgr = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
		vbkgr.image = [UIImage imageNamed:@"images/buttonChoice.png"];
		[self addSubview:vbkgr];
		[vbkgr release];
		
		lblOption = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
		[lblOption setBackgroundColor:[UIColor clearColor]];
		lblOption.textAlignment = UITextAlignmentCenter;
		lblOption.text = @"A. Test";
		lblOption.numberOfLines=4;
		lblOption.textColor = [UIColor whiteColor];
		lblOption.font = [UIFont fontWithName:@"Arial" size:17];
		[self addSubview:lblOption];
		[lblOption release];
		
		UIImage *img = [UIImage imageNamed:@"images/tick.png"];
		imgSelect = [[UIImageView alloc] initWithFrame:CGRectMake(self.frame.size.width - img.size.width, 0, img.size.width, img.size.height)];
		imgSelect.image = img;
		imgSelect.hidden = YES;
		[self addSubview:imgSelect];
		[imgSelect release];
    }
    return self;
}


-(void)setLblOption:(NSString *)info{
	lblOption.text = info;
}

-(void)showCheck:(BOOL)isCheck{
	if(isCheck){
		isCheckOption = YES;
		imgSelect.hidden = NO;
	}else {
		imgSelect.hidden = YES;
		isCheckOption = NO;
	}
}

-(NSString *)getText{
	return lblOption.text;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code.
}
*/

- (void)dealloc {
    [super dealloc];
}


@end
